<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        ul {
            list-style: none;
            display: flex;
            flex-wrap: wrap;
            width: 800px;
            margin: 100px auto;
        }
        
        li {
            width: 100px;
            height: 50px;
            line-height: 50px;
            text-align: center;
            border: 1px solid red;
        }
        
        .active {
            background-color: green;
        }
    </style>
</head>

<body>
    <ul>


    </ul>
    <button class="go">开始随机点名</button>
    <button class="stop">结束随机点名</button>
    <script>
        var arr = [
            "胡宇",
            "武青源",
            "陈宣尧",
            "刘添真",
            "张鹏",
            "邓南健",
            "李康博",
            "毛黎",
            "郑龙龙",
            "蒋凯斌",
            "袁洲立",
            "吴禹博",
            "汤前英",
            "唐凯凯",
            "陈豪",
            "周湘",
            "漆文宇",
            "尹赵炜",
            "贺凌伟",
            "徐绍亮",
            "刘凤",
            "谭佳祥",
            "张平",
            "刘南格",
            "胡杨",
            "易黎",
            "朱涛",
            "罗培基",
            "赖笠",
            "曾颖祺",
            "刘中壹",
            "曾思诚",
            "唐海涛",
            "吴立沛",
            "刘佳琦",
            "刘涛",
            "贺岚",
            "宋彩霞",
            "周虹",
            "何广晨",
            "田梦琪",
            "谢培",
            "何双莲",
            "蔡世鹏",
            "田姜",
            "陈伟",
            "苏鹏",
            "谢秋晗",
            "王泽龙",
            "邓宗帅",
            "袁文峰",
            "王兴成",
            "尹隆杰",
            "李延锋",
            "李澳",
            "李紫欣",
            "何凯",
            "刘彦伶",
            "李高志成",
            "杨义强",
            "石春南",
            "李坤",
            "张虞",
            "陈永杰",
            "陈俊杰",
            "黄续栋",
            "刘志佳",
            "王小丽",
            "刘国盛",
            "徐晓轩",
            "刘刚"
        ]

        var box;

        var go = document.querySelector('.go');
        var stop = document.querySelector('.stop');
        var ul = document.querySelector('ul');
        var state = 0;
        var t;
        for (var k in arr) {
            var li = document.createElement('li');
            li.innerHTML = arr[k]
            ul.append(li)
        }
        go.onclick = function() {
            if (state == 0) {
                clearInterval(t);
                t = setInterval(function() {
                    var s = Math.round(Math.random() * (arr.length - 1))
                    console.log(arr[s]);
                    go.innerHTML = arr[s];



                }, 3)
                stop.innerHTML = "停止"
                state = 1;





            } else {
                state = 0;
                clearInterval(t);
                stop.innerHTML = '开始'

            }


        }
    </script>


</body>

</html>